﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Lifang.Dao
{
    public class SysDmlDao
    {
        public string GetLongCotentByKey(string key)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                return string.Empty;
            }
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("SysUserInfoView", @"SELECT  *
                                                FROM SysUserInfo
                                                WHERE 1 = 1
                                                AND(@UserNo IS NULL OR UserNo = @UserNo)
                                                AND(@UserName IS NULL OR UserName = @UserName)
                                                AND(@UserEmail IS NULL OR UserEmail = @UserEmail)
                                                AND(@MobliePhone IS NULL OR MobliePhone = @MobliePhone)
                                                AND(@CreateTimeEnd IS NULL OR CreateDateTime < @CreateDateEnd)
                                                AND(@CreateTimeStart IS NULL OR CreateDateTime >= @CreateDateTimeStart)
                                                AND(@IsLocked IS NULL OR IsLocked = @IsLocked)");
            dic.Add("CategoryView", @"SELECT *  FROM Category 
                                                WHERE 1 = 1
                                                AND(@Level IS NULL OR Level = @Level)
                                                AND(@Name IS NULL OR Name = @Name)
                                                AND(@IdPath IS NULL OR IdPath = @IdPath)");
            dic.Add("ArticleContentView", @"SELECT * FROM ArticleContent WHERE 1=1
                                    AND(@ArticleId IS NULL OR ArticleId = @ArticleId) 
                                    AND(@DataFlag IS NULL OR DataFlag = @DataFlag) 
                                    AND(@ImageType IS NULL OR ImageType = @ImageType)");
            dic.Add("ArticleView", "SELECT * FROM Article WHERE 1=1  AND(@CategoryId IS NULL OR CategoryId = @CategoryId) AND(@DataFlag IS NULL OR DataFlag = @DataFlag) AND(@IsDel IS NULL OR IsDel = @IsDel) ");
            dic.Add("PageConfigView", "value5");
            dic.Add("key6","value6");
            return (dic.ContainsKey(key)) ? dic[key] : string.Empty;
        }
    }
}
